import 'package:flutter/foundation.dart';

/// 页面状态类型
enum ViewState {
  /// 准备完毕
  Idle,

  /// 加载中
  Loading,

  /// 页面发生了错误
  Error,

  /// 空数据
  Empty,
}

/// 在provider上基础融合对应的控制页面状态属性
mixin ViewStateTypeChangeMixin on ChangeNotifier {
  /// 页面状态
  ViewState _viewState = ViewState.Idle;

  ViewState get viewState => _viewState;

  set viewState(ViewState state) {
    if (_viewState != state) {
      _viewState = state;
      notifyListeners();
    }
  }
}
